#!/usr/bin/env python
# -*- coding:utf-8 -*-

from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client

from s25 import local_settings

secret_id = local_settings.COS_SECRET_ID  # 替换为用户的 secretId
secret_key = local_settings.COS_SECRET_KEY  # 替换为用户的 secretKey

region = 'ap-chengdu'  # 替换为用户的 Region

config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)

client = CosS3Client(config)

# client.delete_object(
#     Bucket='wangyang-1251317460',
#     Key='p1.png'
# )


objects = {
    "Quiet": "true",
    "Object": [
        {
            "Key": "f84de057cc83d51799c0f7c90f52035b.png"
        },
        # 就算桶里没有这个文件不会报错
        {
            "Key": "小米CC9e.jpg"
        }
    ]
}

client.delete_objects(
    Bucket='18708162392-1587469705-1300792884',
    Delete=objects
)
